<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/vue.js"></script>
    <script src="element-ui/lib/index.js"></script>
    <link rel="stylesheet" href="element-ui/lib/theme-chalk/index.css">
    <style>
        .el-table .warning-row {
            background: oldlace;
        }

        .el-table .success-row {
            background: #f0f9eb;
        }
    </style>
</head>
<body>
<div id="app">
    <template>
        <el-form :inline="true" :model="brand" class="demo-form-inline">
            <el-form-item label="当前状态">
                <el-select v-model="brand.sr" placeholder="选择状态">
                    <el-option label="启用" value="1"></el-option>
                    <el-option label="禁用" value="0"></el-option>
                </el-select>
            <el-form-item label="企业名称">
                <el-input v-model="brand.cname" placeholder="企业名称"></el-input>
            </el-form-item>
                <el-form-item label="品牌名称">
                    <el-input v-model="brand.bname" placeholder="品牌名称"></el-input>
                </el-form-item>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="onSubmit">查询</el-button>
            </el-form-item>
        </el-form>

        <el-row>
            <el-button type="danger" plain>批量删除</el-button>
            <el-button type="primary" plain @click="dialogVisible = true">新增</el-button>
            <el-dialog
                    title="提示"
                    :visible.sync="dialogVisible"
                    width="30%"
                    :before-close="handleClose">
                <span>编辑品牌</span>
                <br>

                <el-form ref="form" :model="form" label-width="80px">
                    <el-form-item label="品牌名称">
                        <el-input v-model="brand.bname"></el-input>
                    </el-form-item>

                    <el-form-item label="企业名称">
                        <el-input v-model="brand.cname"></el-input>
                    </el-form-item>

                    <el-form-item label="排序">
                        <el-input v-model="brand.or"></el-input>
                    </el-form-item>

                    <el-form-item label="备注">
                        <el-input type="textarea" v-model="brand.dy"></el-input>
                    </el-form-item>

                    <el-form-item label="状态">
                        <el-switch v-model="brand.sr"></el-switch>
                    </el-form-item>

                    <el-form-item>
                        <el-button type="primary" @click="onSubmit">立即创建</el-button>
                        <el-button>取消</el-button>
                    </el-form-item>
                </el-form>
                <span slot="footer" class="dialog-footer">
  </span>
            </el-dialog>
        </el-row>

        <el-table
                :data="tableData"
                style="width: 100%"
                :row-class-name="tableRowClassName">
            <el-table-column
                    type="selection"
                    width="55">
            </el-table-column>
            <el-table-column
                    type="index"
                    width="50">
            </el-table-column>
            <el-table-column
                    prop="bname"
                    label="品牌">
            </el-table-column>
            <el-table-column
                    prop="cname"
                    label="企业名">
            </el-table-column>
            <el-table-column
                    prop="or"
                    label="排序">
            </el-table-column>
            <el-table-column
                    prop="sr"
                    label="当前状态">
            </el-table-column>
            <el-table-column>
            <el-row>
                <el-button type="primary" disabled>修改</el-button>
                <el-button type="danger" disabled>删除</el-button>
            </el-row>
            </el-table-column>
        </el-table>
        <div class="block">
            <span class="demonstration">完整功能</span>
            <el-pagination
                    @size-change="handleSizeChange"
                    @current-change="handleCurrentChange"
                    :current-page="currentPage4"
                    :page-sizes="[100, 200, 300, 400]"
                    :page-size="100"
                    layout="total, sizes, prev, pager, next, jumper"
                    :total="400">
            </el-pagination>
        </div>
    </template>

</div>


<script>
    new Vue({
      el:"#app",
        methods: {
            tableRowClassName({row, rowIndex}) {
                if (rowIndex === 1) {
                    return 'warning-row';
                } else if (rowIndex === 3) {
                    return 'success-row';
                }
                return '';
            },
            onSubmit() {
                console.log('submit!');
            },
            handleClose(done) {
                this.$confirm('确认关闭？')
                    .then(_ => {
                        done();
                    })
                    .catch(_ => {});
            }
        },data() {
            return {
                form: {
                    name: '',
                    region: '',
                    date1: '',
                    date2: '',
                    delivery: false,
                    type: [],
                    resource: '',
                    desc: ''
                },
                dialogVisible: false,
                brand: {
                    bname: '',
                    cname: '',
                    or:'',
                    sr:"",
                    dy:""
                },
                tableData: [{
                    bname: '小米',
                    cname: '小米有限公司',
                    or: 100,
                    sr:1
                }, {
                    bname: '华为',
                    cname: '华为有限公司',
                    or: 10,
                    sr:0
                }, {
                    bname: '一加',
                    cname: '一加有限公司',
                    or: 200,
                    sr:1
                }, {
                    bname: '步步高',
                    cname: '步步高有限公司',
                    or: 101,
                    sr:1
                }]
            }
        }
    })
</script>
</body>
</html>